#include <stdio.h>
#include "employee.h"
#include "fileio.h"

void displaymenu();

int main() {
    int choice;
    loadfromfile();
    while (1) {
        displaymenu();
        printf("请输入您的选择：");
        scanf("%d", &choice);
        switch (choice) {
        case 1:
            addemployee();
            break;
        case 2:
            searchsalary();
            break;
        case 3:
            modifysalary();
            break;
        case 4:
            deleteemployee();
            break;
        case 5:
            displayall();
            break;
        case 6:
            savetofile();
            break;
        case 7:
            loadfromfile();
            break;
        case 8:
            printf("感谢使用薪资管理系统！\n");
            return 0;
        default:
            printf("无效的选择，请重新输入。\n");
        }
    }
    return 0;
}

void displaymenu() {
    printf("**************** 薪资管理系统 ****************\n");
    printf("*                                          *\n");
    printf("*               1. 录入员工信息              *\n");
    printf("*               2. 查询员工薪资              *\n");
    printf("*               3. 修改员工薪资              *\n");
    printf("*               4. 删除员工信息              *\n");
    printf("*               5. 展示所有员工薪资          *\n");
    printf("*               6. 退出                      *\n");
    printf("*                                          *\n");
    printf("********************************************\n");
}

